home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / muimenu.zip / CODE.H next >
C/C++ Source or Header  |  1994-03-01  |  2KB  |  137 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*                    made by Stefan Stuntz                  */
  4. /*************************************************************/
  5.  
  6. /* MUI */
  7. #include <libraries/mui.h>
  8.  
  9. /* System */
  10. #include <dos/dos.h>
  11. #include <graphics/gfxmacros.h>
  12. #include <workbench/workbench.h>
  13.  
  14. /* Prototypes */
  15. #include <clib/alib_protos.h>
  16. #include <clib/exec_protos.h>
  17. #include <clib/dos_protos.h>
  18. #include <clib/icon_protos.h>
  19. #include <clib/graphics_protos.h>
  20. #include <clib/intuition_protos.h>
  21. #include <clib/gadtools_protos.h>
  22. #include <clib/muimaster_protos.h>
  23. #include <clib/asl_protos.h>
  24.  
  25. /* ANSI C */
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <stdio.h>
  29.  
  30.  
  31. /* Compiler specific stuff */
  32.  
  33. #ifdef _DCC
  34.  
  35. #define REG(x) __ ## x
  36. #define ASM
  37. #define SAVEDS __geta4
  38.  
  39. #else
  40.  
  41. #define REG(x) register __ ## x
  42.  
  43. #ifdef __MAXON__
  44. #define ASM
  45. #define SAVEDS
  46. #else
  47. #define ASM    __asm
  48. #define SAVEDS __saveds
  49. #endif
  50.  
  51. #include <pragmas/exec_pragmas.h>
  52. #include <pragmas/dos_pragmas.h>
  53. #include <pragmas/icon_pragmas.h>
  54. #include <pragmas/graphics_pragmas.h>
  55. #include <pragmas/intuition_pragmas.h>
  56. #include <pragmas/gadtools_pragmas.h>
  57. #include <pragmas/muimaster_pragmas.h>
  58. #include <pragmas/asl_pragmas.h>
  59.  
  60. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  61. struct Library *MUIMasterBase;
  62.  
  63. #endif
  64.  
  65.  
  66. /*************************/
  67. /* Init & Fail Functions */
  68. /*************************/
  69.  
  70. static VOID fail(APTR app,char *str)
  71. {
  72.     if (app)
  73.         MUI_DisposeObject(app);
  74.  
  75. #ifndef _DCC
  76.     if (MUIMasterBase)
  77.         CloseLibrary(MUIMasterBase);
  78. #endif
  79.  
  80.     if (str)
  81.     {
  82.         puts(str);
  83.         exit(20);
  84.     }
  85.     exit(0);
  86. }
  87.  
  88.  
  89. #ifdef _DCC
  90.  
  91. int brkfunc(void) { return(0); }
  92.  
  93. int wbmain(struct WBStartup *wb_startup)
  94. {
  95.     extern int main(int argc, char *argv[]);
  96.     return (main(0, NULL));
  97. }
  98.  
  99. #endif
  100.  
  101.  
  102. #ifdef __SASC
  103. int CXBRK(void) { return(0); }
  104. int _CXBRK(void) { return(0); }
  105. void chkabort(void) {}
  106. #endif
  107.  
  108.  
  109. static VOID init(VOID)
  110. {
  111. #ifdef _DCC
  112.     onbreak(brkfunc);
  113. #endif
  114.  
  115. #ifndef _DCC
  116.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  117.         fail(NULL,"Failed to open "MUIMASTER_NAME".");
  118. #endif
  119. }
  120.  
  121.  
  122. #ifndef __SASC
  123. static VOID stccpy(char *dest,char *source,int len)
  124. {
  125.     strncpy(dest,source,len);
  126.     dest[len-1]='\0';
  127. }
  128. #endif
  129.  
  130.  
  131. #ifndef MAKE_ID
  132. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  133. #endif
  134.  
  135.  
  136. LONG __stack = 8192;
  137.